"""
Case Type   : USTORE
Case Name   : 验证参数enable_ustore的异常值
Create At   : 2025/3/17
Owner       : wan005
Description :
    1.修改enable_ustore值为2,'abc','abc_123$'
Expect      :
    1.修改失败
History     :
"""
import os
import unittest
import sys
from testcase.utils.CommonSH import CommonSH
from testcase.utils.Logger import Logger
from testcase.utils.Constant import Constant


class Security(unittest.TestCase):
    def setUp(self):
        self.logger = Logger()
        self.logger.info(f'---{os.path.basename(__file__)} start---')
        self.sh_primy = CommonSH('PrimaryDbUser')
        self.constant = Constant()

    def test_ustore(self):
        text = '----step1:修改参数值为2,abc,abc_123$;expect:失败----'
        self.logger.info(text)
        err_msg1 = 'The value "2" for parameter "enable_ustore"' \
                   ' is incorrect, requires a boolean value'
        res2_1 = self.sh_primy.execute_gsguc('reload', err_msg1,
                                    'enable_ustore=2')
        self.assertEqual(True, res2_1, text + '执行失败')
        err_msg2 = 'The value "\'abc\'" for parameter ' \
        '"enable_ustore" is incorrect, requires a boolean value'
        res2_2 = self.sh_primy.execute_gsguc('reload', err_msg2,
                                    'enable_ustore=\'abc\'')
        self.assertEqual(True, res2_2, text + '执行失败')
        err_msg3 = 'The value "\'abc_123$\'" for parameter ' \
        '"enable_ustore" is incorrect, requires a boolean value'
        res2_3 = self.sh_primy.execute_gsguc('reload', err_msg3,
                                    'enable_ustore=\'abc_123$\'')
        self.assertEqual(True, res2_3, text + '执行失败')

    def tearDown(self):
        self.logger.info(f'---{os.path.basename(__file__)} end---')
